home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
pdox693.zip
/
TI497.ASC
< prev
next >
Wrap
Text File
|
1992-08-12
|
5KB
|
199 lines
PRODUCT : Paradox NUMBER : 497
VERSION : 3.xx
OS : DOS
DATE : August 12, 1992 PAGE : 1/3
TITLE : PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
Imagine that you need to print multiple labels for each record in
a table. Normally, you would use the report generator to output
a report, however, reports in Paradox can print each record only
one time. This is useful when you have to print labels for
shipping several boxes to the same address and you want to label
each box 1 of 5, 2 of 5, etc.
The following script is an example of how to create those records
in a new table. The script creates an output table on the fly,
brings both the old table and the output table on the workspace.
It then scans through the original table to get the existing
records information. Once it has the number of records to be
created in the output table, it then inserts n number of records
in the output table using the CopyFromArray PAL command. Last
but not least, it will number the records in the output table.
The script needs a source table called "ORIGINAL" with the
following structure:
Field Name Field Type
FIRST NAME A15
LAST NAME A30
ADDRESS 1 A40
CITY NAME A20
STATE A2
ZIP CODE A5
LABEL COUNT S
The field called "LABEL COUNT" is used to determine the number of
records to place in the output table. The name of the output
table that is created is called "LABELRPT". All references to
table names and field names may be changed at will.
Once you have actually implemented the PAL code, you can then use
the output table to print reports that produce labels that are
number x of n where x is the count of the number of labels
printed so far and where n is the total number of labels to be
printed.
PRODUCT : Paradox NUMBER : 497
VERSION : 3.xx
OS : DOS
DATE : August 12, 1992 PAGE : 2/3
TITLE : PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
For example, you could print labels like...
Johnny Johnson 1 of 2
1800 Green Hills Road
Scotts Valley, CA 95066-0001
Johnny Johnson 2 of 2
1800 Green Hills Road
Scotts Valley, CA 95066-0001
Here is the actual code that will do all the work:
If IsTable("labelrpt") Then ; Delete Output Table
Delete "labelrpt"
EndIf
Create "labelrpt" ; Create Output Table
"First Name" : "A15", ; First Name field
"Last Name" : "A30", ; Last Name field
"Address 1" : "A40", ; Address field
"City Name" : "A20", ; City field
"State" : "A2", ; State field
"Zip Code" : "A5", ; Zip code field
"Label #" : "S", ; Label # field
"Label Total" : "S" ; Label total field
PRODUCT : Paradox NUMBER : 497
VERSION : 3.xx
OS : DOS
DATE : August 12, 1992 PAGE : 3/3
TITLE : PRINTING MULTIPLE LABELS FOR EACH RECORD IN A TABLE
Proc MakeLabels() ; Define procedure
ClearAll ; Clear the WorkSpace
Clear ; Clear the PAL Canvas
View "labelrpt" ; View the output table
View "original" ; View original table
Editkey ; Place tables in EDIT
Scan ; Begin Scan Loop
MakeRecNo = [Label Count] ; Get number of records
CopyToArray HoldRec ; Copy record to memory
Message "Processing Record ",RecNo() ; Display user message
UpImage ; Moveto output table
For lv from 1 to MakeRecNo ; Begin making records
CopyFromArray HoldRec ; Insert a copy
[Label Total] = [Label #] ; Modify records number
[Label #] = lv ; Define records total
Down ; Moveto blank record
EndFor ; End making records
DownImage ; Moveto original table
EndScan ; End Scan Loop
DO_IT! ; Save output records
ClearImage ; Clear original table
Home ; Moveto record #1
EndProc ; End Procedure
MakeLabels() ; Invoke the procedure
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.